package com.ruoyi.web.studentmanagementsystem.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.web.studentmanagementsystem.dto.*;
import com.ruoyi.web.studentmanagementsystem.pojo.SysTeacher;
import com.ruoyi.web.studentmanagementsystem.service.ISysTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/ISysTeacherService")
@Api(tags = "老师表接口相关")
public class TeacherController {
    @Resource
    private ISysTeacherService iSysTeacherService;

    @PostMapping(  "/insertTeacher")
    @ApiOperation("老师表——增")
    public R<String> insertTeacher(@RequestBody ISysTeacherDTO teacher) {
        iSysTeacherService.insertTeacher(teacher);
        return R.ok();
    }

    @PostMapping(  "/deleteTeacherId/{teacherId}")
    @ApiOperation("老师表——删")
    public R<String> deleteTeacherId(@PathVariable String teacherId) {
        iSysTeacherService.deleteTeacherId(teacherId);
        return R.ok();
    }

    @PostMapping(  "/selectteacherName/{teacherName}")
    @ApiOperation("老师表——查")
    public R<List<SysTeacher>> selectTeacherName(@PathVariable String teacherName) {
        return R.ok(iSysTeacherService.selectTeacherName(teacherName));
    }

    @PostMapping(  "/updateStudent")
    @ApiOperation("老师表——改")
    public R<String> updateTeacher(@RequestBody IISysTeacherDTO teacher) {
        iSysTeacherService.updateTeacher(teacher);
        return R.ok();
    }
}
